tekkitclassicfandomcom-20200214-history
Monitor (ComputerCraft)
The ComputerCraft Monitor is a peripheral that allows a Console to display things without being close to it or opening the console GUI. When placed together, they will form a single, bigger, monitor. The largest size for a single monitor is 6-by-8 (6 blocks tall, 8 blocks wide) Recipe ComputerCraft Commands In the console, a program can be run by using the monitor command in the console with the following format: monitor program but this means that if you have a program that starts automatically, such as something to display IC2 Nuclear Reactor information, it won't start up displaying information on the monitor, it will just display it on the console. If you type "monitor shell", other things you type will show up on the monitor on instead of the GUI. Doing this saves you the trouble of using "monitor ", but if you want to stop doing so, you need to break and replace (or reboot) the computer. You can instead use the code (in LUA mode): side = "" -Enter left, right, or any other valid side inside the quotations term.redirect(peripheral.wrap(side)) but this will put everything on the monitor that would normally be on the console. Even if you open the GUI and enter another command, it will display on the monitor instead, which is inconvient as you have to close the GUI and look at the monitor to see if you typed something right. Instead, in your code, you can say: mon = peripheral.wrap("side") where side is the side the monitor is on. Now if you want to, say print something on the monitor, you can type: mon.write("Hello world!") And it will have the desired effect. To clear the entire using code, type in mon.clear() And to reset the position of the cursor, mon.setCursorPos(x,y) Keep in mind that these commands do not come with the computer. These are all Lua type commands, which means that you have to make a program to utilize them. For something simple, type this in the console: monitor secret/alongtimeago Now for an example program, this runs a clock on a 1x2 or 1x3 monitor side = "back" --This is the side of the monitor text = "Put company name etc. here" mon = peripheral.wrap(side) mon.setTextScale(2) while true do mon.clear() mon.setCursorPos(1,1) mon.write(text) mon.setCursorPos(1,2) mon.write(textutils.formatTime(os.time(),false)) -- use false for 12h time -- os.time() returns the time of the Minecraft day, -- corresponding closely but not exactly to the sun position. sleep(1) -- 0.2 would be smoother, but causes quite severe lag. end To end the program just hold ctrl + T It is also worth noting that the computer terminal can be redirected to the monitor using term.redirect(target). Make sure to restore the terminal to the computer before ending the program. Here is an example: mon = peripheral.wrap("side") term.redirect(mon) --This changes the terminal to the monitor. print("This prints on the monitor!") mon.write("This will print on the monitor too!") term.restore() --Returns the terminal to the computer screen. print("I print to the computer screen!") mon.write("I still print to the monitor!") Bugs Applicable to the version of ComputerCraft in Tekkit Classic. * Drawing text on the monitor seems quite laggy. With the above example clock program on a 7x3-block screen, running on a Core i5 & Geforce 1050, lag is clearly noticeable when you try to walk around. (May be a conflict with Teleport Tether.) * The text flickers and disappears into the background when you move a few blocks away from the monitor. (This is a typical symptom of the text being drawn on a different surface to the background.) Category:ComputerCraft